<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>glClear - OpenGL ES 3.1 Reference Pages</title>
    <link rel="stylesheet" type="text/css" href="opengl-man.css"/>
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1"/>
    <script type="text/x-mathjax-config">
            MathJax.Hub.Config({
                MathML: {
                    extensions: ["content-mathml.js"]
                },
                tex2jax: {
                    inlineMath: [['$','$'], ['\\(','\\)']]
                }
            });
        </script>
    <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"/>
  </head>
  <body>
    <header/>
    <div class="refentry" id="glClear">
      <div class="titlepage"/>
      <div class="refnamediv">
        <h2>Name</h2>
        <p>glClear — clear buffers to preset values</p>
      </div>
      <div class="refsynopsisdiv">
        <h2>C Specification</h2>
        <div class="funcsynopsis">
          <table style="border: 0; cellspacing: 0; cellpadding: 0;" class="funcprototype-table">
            <tr>
              <td>
                <code class="funcdef">void <strong class="fsfunc">glClear</strong>(</code>
              </td>
              <td>GLbitfield <var class="pdparam">mask</var><code>)</code>;</td>
            </tr>
          </table>
          <div class="funcprototype-spacer"> </div>
        </div>
      </div>
      <div class="refsect1" id="parameters">
        <h2>Parameters</h2>
        <div class="variablelist">
          <dl class="variablelist">
            <dt>
              <span class="term">
                <em class="parameter">
                  <code>mask</code>
                </em>
              </span>
            </dt>
            <dd>
              <p>
                    Bitwise OR of masks that indicate the buffers to be cleared.
                    The three masks are
                    <code class="constant">GL_COLOR_BUFFER_BIT</code>,
                    <code class="constant">GL_DEPTH_BUFFER_BIT</code>, and
                    <code class="constant">GL_STENCIL_BUFFER_BIT</code>.
                </p>
            </dd>
          </dl>
        </div>
      </div>
      <div class="refsect1" id="description">
        <h2>Description</h2>
        <p>
            <code class="function">glClear</code> sets the bitplane area of the window to values previously selected
            by <code class="function">glClearColor</code>, <code class="function">glClearDepthf</code>, and
            <code class="function">glClearStencil</code>.
            Multiple color buffers can be cleared simultaneously by selecting
            more than one buffer at a time using <a class="citerefentry" href="glDrawBuffers.xhtml"><span class="citerefentry"><span class="refentrytitle">glDrawBuffers</span></span></a>.
        </p>
        <p>
            The pixel ownership test,
            the scissor test,
                        sRGB conversion,
            dithering, and the buffer writemasks affect the operation of <code class="function">glClear</code>.
            The scissor box bounds the cleared region.
            Alpha function,
            blend function,
            stenciling,
            texture mapping,
            and depth-buffering are ignored by <code class="function">glClear</code>.
        </p>
        <p>
            <code class="function">glClear</code> takes a single argument that is the bitwise OR of several
            values indicating which buffer is to be cleared.
        </p>
        <p>
            The values are as follows:
        </p>
        <div class="variablelist">
          <dl class="variablelist">
            <dt>
              <span class="term">
                <code class="constant">GL_COLOR_BUFFER_BIT</code>
              </span>
            </dt>
            <dd>
              <p>
                        Indicates the buffers currently enabled for color
                        writing.
                    </p>
            </dd>
            <dt>
              <span class="term">
                <code class="constant">GL_DEPTH_BUFFER_BIT</code>
              </span>
            </dt>
            <dd>
              <p>
                        Indicates the depth buffer.
                    </p>
            </dd>
            <dt>
              <span class="term">
                <code class="constant">GL_STENCIL_BUFFER_BIT</code>
              </span>
            </dt>
            <dd>
              <p>
                        Indicates the stencil buffer.
                    </p>
            </dd>
          </dl>
        </div>
        <p>
            The value to which each buffer is cleared depends on the setting of the
            clear value for that buffer.
        </p>
      </div>
      <div class="refsect1" id="notes">
        <h2>Notes</h2>
        <p>
            If a buffer is not present,
            then a <code class="function">glClear</code> directed at that buffer has no effect.
        </p>
      </div>
      <div class="refsect1" id="errors">
        <h2>Errors</h2>
        <p>
            <code class="constant">GL_INVALID_VALUE</code> is generated if any bit other than the three defined
            bits is set in <em class="parameter"><code>mask</code></em>.
        </p>
      </div>
      <div class="refsect1" id="associatedgets">
        <h2>Associated Gets</h2>
        <p>
            <a class="citerefentry" href="glGet.xhtml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_DEPTH_CLEAR_VALUE</code>
        </p>
        <p>
            <a class="citerefentry" href="glGet.xhtml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_COLOR_CLEAR_VALUE</code>
        </p>
        <p>
            <a class="citerefentry" href="glGet.xhtml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_STENCIL_CLEAR_VALUE</code>
        </p>
      </div>
      <div class="refsect1" id="versions">
        <h2>API Version Support</h2>
        <div class="informaltable">
          <table style="border-collapse: collapse; border-top: 2px solid ; border-bottom: 2px solid ; border-left: 2px solid ; border-right: 2px solid ; ">
            <colgroup>
              <col style="text-align: left; "/>
              <col style="text-align: center; " class="firstvers"/>
              <col style="text-align: center; "/>
              <col style="text-align: center; " class="lastvers"/>
            </colgroup>
            <thead>
              <tr>
                <th style="text-align: left; border-right: 2px solid ; ">
                 
            </th>
                <th style="text-align: center; border-bottom: 2px solid ; " colspan="3">
                <span class="bold"><strong>OpenGL ES API Version</strong></span>
            </th>
              </tr>
              <tr>
                <th style="text-align: left; border-right: 2px solid ; border-bottom: 2px solid ; ">
                <span class="bold"><strong>Function Name</strong></span>
            </th>
                <th style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">
                <span class="bold"><strong>2.0</strong></span>
            </th>
                <th style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">
                <span class="bold"><strong>3.0</strong></span>
            </th>
                <th style="text-align: center; border-bottom: 2px solid ; ">
                <span class="bold"><strong>3.1</strong></span>
            </th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td style="text-align: left; border-right: 2px solid ; ">glClear</td>
                <td style="text-align: center; border-right: 2px solid ; ">✔</td>
                <td style="text-align: center; border-right: 2px solid ; ">✔</td>
                <td style="text-align: center; ">✔</td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
      <div class="refsect1" id="seealso">
        <h2>See Also</h2>
        <p>
            <a class="citerefentry" href="glClearBuffer.xhtml"><span class="citerefentry"><span class="refentrytitle">glClearBuffer</span></span></a>,
            <a class="citerefentry" href="glClearColor.xhtml"><span class="citerefentry"><span class="refentrytitle">glClearColor</span></span></a>,
            <a class="citerefentry" href="glClearDepthf.xhtml"><span class="citerefentry"><span class="refentrytitle">glClearDepthf</span></span></a>,
            <a class="citerefentry" href="glClearStencil.xhtml"><span class="citerefentry"><span class="refentrytitle">glClearStencil</span></span></a>,
            <a class="citerefentry" href="glColorMask.xhtml"><span class="citerefentry"><span class="refentrytitle">glColorMask</span></span></a>,
            <a class="citerefentry" href="glDepthMask.xhtml"><span class="citerefentry"><span class="refentrytitle">glDepthMask</span></span></a>,
            <a class="citerefentry" href="glDrawBuffers.xhtml"><span class="citerefentry"><span class="refentrytitle">glDrawBuffers</span></span></a>,
            <a class="citerefentry" href="glScissor.xhtml"><span class="citerefentry"><span class="refentrytitle">glScissor</span></span></a>,
            <a class="citerefentry" href="glStencilMask.xhtml"><span class="citerefentry"><span class="refentrytitle">glStencilMask</span></span></a>
        </p>
      </div>
      <div class="refsect1" id="Copyright">
        <h2>Copyright</h2>
        <p>
            Copyright <span class="trademark"/>© 1991-2006 Silicon Graphics, Inc.
            Copyright <span class="trademark"/>© 2010-2014 Khronos Group.
            This document is licensed under the SGI Free Software B License.
            For details, see
            <a class="link" href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>.
        </p>
      </div>
    </div>
    <footer/>
  </body>
</html>
